package com.practices2.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.ImageView;

public class BolderImageView extends ImageView {

	private Paint paint = null;

	public BolderImageView(Context context, AttributeSet attrs) {
		super(context, attrs);
		initPaint();
	}

	private void initPaint() {
		paint = new Paint();
		paint.setColor(Color.RED);
		//1--255,1为透明，255为完全不透明。
		paint.setAlpha(255);
		paint.setStyle(Paint.Style.FILL);
		paint.setStrokeCap(Paint.Cap.ROUND);
		paint.setStrokeWidth(5);
	}

	@Override
	protected synchronized void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		Rect rect=new Rect();
		rect.right--;
		rect.bottom--;
		canvas.drawRect(rect, paint);
//		// top
//		canvas.drawLine(0, 0, this.getWidth() + 3, 0, paint);
//		// bottom
//		canvas.drawLine(0, getHeight() - 1, getWidth() - 1, getHeight() - 1, paint);
//		// left
//		canvas.drawLine(0, 0, 0, getHeight() - 1, paint);
//		// right
//		canvas.drawLine(getWidth() - 1, 0, getWidth() - 1, getHeight() - 1, paint);

	}

}
